#!/bin/sh

OS=`fpc -iSO`
CPU=`fpc -iSP`

BUILD_ARGS="-l -Mobjfpc -Sh -CX -OG2p3 -Xs -Fulib/common/* -Fulib/common/kernel/${CPU}-${OS} -Fi/lib/common/kernel"

compile_dir() {
    local f
    for f in `ls -A1 $1/*.pas`; do
	fpc $f $BUILD_ARGS 
    done
}

source `dirname $0`/clean_all.sh

for f in `ls -A1 lib/common/kernel/mseconsts_*.pas`; do
    fpc $f $BUILD_ARGS
done

compile_dir lib/common/i18n
compile_dir lib/common/unicode

fpc tools/bmp2pas.pas $BUILD_ARGS -XX
fpc tools/form2pas.pas $BUILD_ARGS -XX

fpc tools/i18n/msei18n.pas $BUILD_ARGS
fpc apps/ide/mseide.pas $BUILD_ARGS 

# compile_dir lib/common/ifi
